-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encrypt keys with trussed-auth #127
Conversation
This PR encrypts:
Am I missing something? |
The PIN length is still stored unencrypted but I don't see anyway to avoid this. Maybe store it in the internal flash? |
Why do we need to store the PIN length? |
Because |
Is this demanded by the OpenPGP Card specification? |
@jans23 Yes, that's the way of changing the PIN per specification - giving both concatenated without additional information. |
97e8e89
to
eb75b75
Compare
More detailed encryption mechanism: User data that can be encrypted is. This applies to:
The same is true for admin data (private use data object 4). All other data need to be accessible without verifying a PIN, and therefore cannot be encrypted using user-provided entropy. Encryption uses keys wrapped using the user and admin PIN coming from Encryption pathEncryption (normal) path:
The 3 PGP keys are stored wrapped with the user key. They are only stored unwrapped in volatile memory temporarly when being generated, imported or used (with some caching). User key wrappingThis path is by itself incompatible with the OpenPGP standard. Key generationOnly the admin pin is required generate and import PGP keys. User PIN unblockThe admin pin and the resetting code need to be able to reset the user pin, but the user must then still be able to unwrap the PGP keys. User key "backups"To adapt to the two above use cases, the user key is backed up twice. Card administrationWhen the admin generates or imports a PGP key, the card uses the admin key to unwrap User PIN resetWhen Private use data objectsObjects are majoritarly readable without authentication and therefore are store in plain text.
With a schema in nextcloud: https://cloud.nitrokey.com/f/522841 |
68787ce
to
bd0dae6
Compare
ffb21c2
to
93b0fc2
Compare
f618039
to
c4d714f
Compare
54c51fa
to
ebd5229
Compare
I'll break this PR into some smaller PRs for easier review. |
set_key is called by an adminin, so the key needs to be obtained from the admin key
This was introduced by rebasing on top of the rsa-backend migration This should not be done since public keys are expected to be stored in persistent storage since they can't be lazily derived from the private part that is encrypted
ebd5229
to
6543334
Compare
To do before the final merge:
|
Thanks for splitting up the PR! The code changes look good to me. |
Replaced by #139 |
Built on top of #125 and trussed-dev/trussed-auth#17
This PR adds encryption for the user keys that will end up stored on the external flash.